/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2013-2014 sagyf Yang. The Four Group.
 */

package app.models.booking;

import com.github.sog.annotation.TableBind;
import com.github.sog.plugin.sqlinxml.SqlKit;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;

import java.util.List;

/**
 * <p>
 * .
 * </p>
 *
 * @author sagyf yang
 * @version 1.0 2014-05-26 22:59
 * @since JDK 1.6
 */
@TableBind(tableName = "ol_dining_nums")
public class DiningNums extends Model<DiningNums> {
    /**
     * The public dao.
     */
    public static final  DiningNums dao              = new DiningNums();
    private static final long       serialVersionUID = -2467937541894374553L;

    /**
     * 根据品牌和桌位查询可预订数量
     *
     * @param brand         品牌
     * @param tableCategory 桌位类型
     * @return 桌位类型
     */
    public DiningNums findByBrandAndCategorg(long brand, int tableCategory) {
        return findFirst(SqlKit.sql("diningnums.findByBrandAndCategorg"), brand, tableCategory);
    }

    public List<DiningNums> findByBrand(long brand) {
        return find(SqlKit.sql("diningnums.findByBrand"), brand);
    }

    public void deleteByCategory(int category) {
        Db.update(SqlKit.sql("diningnums.deleteByCategory"), category);

    }
}